package com.eques.demo.adapter.viewhoder

import android.content.Context
import android.view.View
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.eques.bean.WeekBean
import com.eques.demo.R
import com.eques.impl.OnClickListenerImpl


@Suppress("DEPRECATION")
class WeeKHoder(itemView: View?) : RecyclerView.ViewHolder(itemView!!) {

    private val tv_week: TextView = itemView!!.findViewById(R.id.tv_monday)

    fun setData(context: Context, weekBeans: List<WeekBean>, position:Int, onItemClickListener: OnClickListenerImpl) {
        val weekBean: WeekBean = weekBeans[position]
        tv_week.text = weekBean.name
        if (weekBean.isChoose) {
            tv_week.setTextColor(context.resources.getColor(R.color.white))
            tv_week.setBackgroundResource(R.drawable.voice_time_choose)
        } else {
            tv_week.setTextColor(context.resources.getColor(R.color.text_color))
            tv_week.setBackgroundResource(R.drawable.voice_time_unchoose)
        }
        itemView.setOnClickListener(View.OnClickListener {
            onItemClickListener.CallBackItemClickListener(position,0,0)
        })
    }
}